package com.lry.sso.service.redis.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * redis单机配置
 *
 * @author 李瑞益
 * @date 2019/12/12
 */
@Data
@ConfigurationProperties(prefix = "redis")
public class SsoRedisProperties {

    /**地址*/
    private String host;
    /**端口*/
    private int port;
    /**密码*/
    private String password;
    /**超时时间*/
    private int timeout;
    /**最大连接数*/
    private int maxTotal;
    /**最大空闲数*/
    private int maxIdle;
    /**最小空闲数*/
    private int minIdle;
    /**最大等等时间*/
    private long maxWaitMillis;
    /**测试可用性*/
    private boolean testOnBorrow;
    private boolean testOnReturn;
    private boolean testWhileIdle;
    private int select = 0;

    private Cluster cluster;

    @Data
    public static class Cluster {

        /**节点*/
        private List<String> nodes;

        /**集群密码*/
        private String password;

        /**读取数据超时时间*/
        private int soTimeout = 10000;

        /**最大尝试次数*/
        private int maxAttempts = 3;

        private int maxTotal;
        private int maxIdle;
        private int minIdle;

        private boolean blockWhenExhausted = false;

        private int maxWaitMillis;

    }
}
